<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html">
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title></title>
</head>
<body erke-hide>
</body>
<script>
/**
 * @param {number[]} houses
 * @param {number[]} heaters
 * @return {number}
 */
var findRadius = function(houses, heaters) {
	houses=houses.sort(aAronDie);
	heaters=heaters.sort(aAronDie);
    var res=[];
    for(var i=0;i<houses.length;i++){
    	var min=Math.max(houses[houses.length-1],heaters[heaters.length-1]);
    	for(var j=0;j<heaters.length;j++){
    		if(Math.abs(houses[i]-heaters[j])<=min){
    			min=Math.abs(houses[i]-heaters[j]);
    		};
    	};
    	 res.push(min);
    };
    console.log(res);
    res=res.sort(aAronDie);
    console.log(res[res.length-1]);
    return res[res.length-1];
};
function aAronDie(a,b){
	return a-b;
};
var res=new findRadius([1,2,3,4],[1,4]);
</script>
</html>